package it.koutifaris.travianmap.ui.drawhelpers.village;

import it.koutifaris.travianmap.ui.MapDetailsLevel;

import java.util.EnumMap;

public class VillageDrawerFactory {

	private final EnumMap<MapDetailsLevel, VillageDrawer> association;

	public VillageDrawerFactory(VillageDrawerConfig config) {
		association = new EnumMap<MapDetailsLevel, VillageDrawer>(MapDetailsLevel.class);
		for (MapDetailsLevel mapDetailsLevel : MapDetailsLevel.values()) {
			if (config.getDrawerFor(mapDetailsLevel) == null) {
				throw new IllegalArgumentException("MapDetailsLevel " + mapDetailsLevel + " not in the configuration");
			}
			association.put(mapDetailsLevel, config.getDrawerFor(mapDetailsLevel));
		}
	}

	public VillageDrawer getVillageDrawer(MapDetailsLevel detailsLevel) {
		return association.get(detailsLevel);
	}
}
